package com.wr.dao;

import com.wr.model.RestResponse;
import com.wr.model.User;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author weirong
 * @Title:
 * @Description:
 * @date 2018/6/1114:56
 */
@FeignClient(value = "user-server")
public interface UserDao {


    @RequestMapping(value = "user/add")
    RestResponse<User> register(@RequestBody User user);

    @RequestMapping(value = "user/getUserByEmail")
    RestResponse<User> getUserByEmail(@RequestParam(value = "email") String email);

    @RequestMapping(value = "user/getUserByUserName")
    RestResponse<User> getUserByUserName(@RequestParam(value = "username") String username);

    @RequestMapping(value = "user/getUserById")
    RestResponse<User> getUserById(@RequestParam(value = "id") Integer id);

    @RequestMapping(value = "user/authLogin")
    RestResponse<User> authLogin(@RequestBody User user);

    @RequestMapping(value = "user/getUserByToken")
    RestResponse<User> getUserByToken(@RequestParam(value = "token") String token);

    @RequestMapping(value = "user/logout")
    RestResponse<User> logout(@RequestParam(value = "token")  String token);

    /**
     * 重置密码
     * @param user
     * @return
     */
    @RequestMapping(value = "user/resetPw")
    RestResponse<User> resetPw(@RequestBody User user);

    @RequestMapping(value = "user/update")
    RestResponse<User> update(@RequestBody User user);
}
